package com.share.iostream;

import java.io.*;

/**
 * 
 * @author Johnny Tam
 *
 *	printStream 针对字节
 */

public class TestPrintStream1 {
	public static void main(String[] args) {
		PrintStream ps = null;//
		try {
			FileOutputStream fos = new FileOutputStream("e:\\test\\log.dat");
			ps = new PrintStream(fos);
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		System.out.println(ps);
		
		if (ps != null) {
			//System.setOut(ps);//重定项屏幕输出到ps对象中
			System.out.println( "ps != null");
		}
		
		int ln = 0;
		System.out.println(ln);
		
		for (char c = 0; c <= 200; c++) {
			System.out.print((int)c + " ");
			
			if (ln++ >= 10) {
				System.out.println();
				ln = 0;
			}
		}
		
	}
}
